<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="_meta :: header">
    <title>预览</title>
    <script charset="utf-8" src="<%=basePath%>/plug-in/ueditor143/ueditor.config.js"></script>
      <script charset="utf-8" src="<%=basePath%>/plug-in/ueditor143/ueditor.all.js"></script>
      <script type="text/javascript" src="<%=basePath%>/plug-in/jquery/jquery-1.12.2.min.js"></script>
</head>
<body>
<div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form form form-horizontal" id="form-video-edit" action="#"
                      th:action="@{/admin/fileUpload/uploadPPTVideo}" th:object="${draft}" enctype="multipart/form-data">
                    <input type="hidden" name="id" th:value="${draft.id}"/>
                    <input type="hidden" id="action" name="action" value="">

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                class="c-red">*</span>稿件标题：</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" th:value="${draft.draftTitle}" name="draftTitle"
                                   placeholder="修改稿件标题" id="draftTitle" style="width:400px;"/>

                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                class="c-red">*</span>稿件文件名：</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" th:value="${draft.fileName}" name="fileName"
                                   placeholder="修改稿件文件名" id="fileName" style="width:400px;"/>

                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                class="c-red">*</span>稿件内容：</label>
                        <div class="layui-input-block">
                            <script id="editor" th:text="${draft.draftText}" name="draftText" autofocus
                                    type="text/plain" style="height: 500px">
                            </script>
                            <input id="editorInput" type="hidden" name="" th:value="${draft.draftText}">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span
                                class="c-red">*</span>稿件类型：</label>
                        <div class="layui-input-inline" style="line-height:38px">
                            <span th:if="${draft.draftType eq 4}">PPT录屏稿件</span>
                            <span th:if="${draft.draftType eq 3}">音频转视频稿件</span>
                        </div>
                    </div>
                    <div class="layui-form-item" th:if="${draft.draftType eq 3 }">
                        <label class="layui-form-label">音频：</label>
                        <div class="layui-input-inline" style="line-height:20px;">
                            <div class="layui-input-block">
                                <audio th:src="${audio?.audioUrl}" id="audioUrl" controls="controls"></audio>
                            </div>
                            <input type="hidden" th:value="${audio?.audioUrl}" id="audiourlss">
                        </div>
                    </div>

                        <div class="layui-form-item" th:if="${oneFlag eq '1001'}">
                            <label class="layui-form-label"><span
                                    class="c-red">*</span>上传音频：</label>
                            <div class="layui-input-inline">
                                <div style="display:inline" >
                                    <label th:for="${'filesave'}" title="点击上传">
                                        <a title="上传"
                                           class="layui-btn">上传</a>
                                    </label>
                                    <input style="display: none" th:id="${'filesave'}" class="filesave" type="file"  name="file"
                                           multiple="multiple" accept="audio/*" th:data-url="${'/admin/audio/saveAudio?id='+draft.id}">
                                </div>
                            </div>
                        </div>

                    <div class="layui-form-item" th:if="${draft.draftType eq 4}">
                        <label class="layui-form-label"></span>PPT查看：</label>
                        <div class="layui-input-inline">
                            <div style="display:inline">
                                <label>
                                    <a th:href="${ppt?.pptUrl}" id="pttId"
                                       class="layui-btn">下载PPT</a>
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item" th:if="${firstFlag ne '1001'}" id="LookVideo">
                        <label class="layui-form-label">查看视频：</label>
                        <div class="imgcon" style="float:left;">
                        </div>
                        <input type="hidden" value="" name="meetingIcon" class="goods_img">
                        <input type="hidden" th:value="${video?.id}" id="videoId" >
                        <input type="hidden" th:value="${video?.videoUrl}" id="videourlss">
                        <input type="hidden" th:value="${draft.id}" id="draftId">
                        <input type="hidden" th:value="${video?.statusCode}" id="videoStatusCode" >
                        <input type="hidden" th:value="${ppt?.statusCode}" id="pptStatusCode">
                        <input type="hidden" th:value="${draft}" id="draft">
                        <input type="hidden" th:value="${video?.draftType}" id="videodraftType" >
                        <input type="hidden" th:value="${video?.groupId}" id="videoGroupId">
                        <input type="hidden" th:value="${draft.draftType}" id="draftType" >
                        <div class="addimg" style="float: left ;">
                            <div id="drag" class="" title="将文件拖拽到此处上传">
                                <label title="点击预览">
                                    <video th:src="${video?.videoUrl}" id="videoUrlId" controls="controls" preload="preload"
                                           style="height: 200px;width: 300px;" alt=""></video>
                                </label>
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item" th:if="${video ne null}" id="videofileName">
                        <label class="layui-form-label">
                            <span class="c-red"></span>
                            视频文件名:
                        </label>
                        <div class="layui-input-inline" id="showVideoname">
                             <span class="layui-form-label" id="videouploadname">
                                 <span class="show"></span>
                             </span>
                            <input type="text" readonly="true" class="layui-input" th:value="${video?.uploadFilename}"
                                   name="uploadFilename" placeholder="上传文件名" id="uploadFilename"/>
                        </div>
                    </div>

                     <div class="layui-form-item" th:if="${firstFlag ne '1001' and pptUpload eq '1001'}">
                        <label class="layui-form-label" th:if="${draft.draftType eq 4}"><span
                                class="c-red">*</span>上传录屏：</label>
                        <label class="layui-form-label" th:if="${draft.draftType eq 3}"><span
                                class="c-red">*</span>上传视频：</label>
                            <div class="layui-input-inline">
                            <div style="display:inline" >
                                <label th:for="${'fileupload'}" title="点击上传">
                                    <a title="上传" class="layui-btn" style="text-decoration:none">上传</a>
                                </label>
<!--                                上传录屏-->
                                <input  th:if="${draft.draftType eq 4}" th:id="${'fileupload'}" style="display: none" class="fileupload" type="file"  name="file"
                                        th:onchange="videoName(this)"
                                        multiple="multiple" accept="video/mp4"  th:data-url="${'/admin/fileUpload/uploadPPTVideo?draftId='+ppt.draftId+'&groupId='+ppt.groupId}">
<!--                                上传音频-->
                                <input  th:if="${draft.draftType eq 3 && oneFlag ne '1001'}" th:id="${'fileupload'}" style="display: none" class="fileupload" type="file"  name="file"
                                        multiple="multiple" accept="video/mp4"  th:data-url="${'/admin/fileUpload/uploadAudioVideo?draftId='+audio.draftId+'&groupId='+audio.groupId}">
                                <input  th:if="${draft.draftType eq 3 && oneFlag eq '1001'}" th:id="${'fileupload'}" style="display: none" class="fileupload" type="file"  name="file"
                                        multiple="multiple"  accept="video/mp4" th:data-url="${'/admin/fileUpload/uploadAudioVideo?draftId='+draft.id+'&groupId='+draft.groupId}">
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item" th:if="${video ne null}" id="videosMaker">
                        <label class="layui-form-label">
                            <span class="c-red"></span>
                            视频制作人:
                        </label>
                        <div class="layui-input-inline">
                            <input type="text" readonly="true" class="layui-input" th:value="${name[video?.videoMaker]}"
                                   name="videoMaker" placeholder="修改视频制作人" id="videoMaker"/>
                        </div>


                    </div>
                    <div class="layui-form-item" th:if="${checkFlag eq '1001'}">
                        <label class="layui-form-label">驳回理由：</label>
                        <div class="layui-input-block">
                            <textarea placeholder="请入驳回理由" th:if="${reasonFlag ne '1001'}" type="text" rows="10"
                                      cols="100" id="disAllowdReason" name="disAllowdReason"/></textarea>
                            <textarea placeholder="请入驳回理由" th:if="${reasonFlag eq '1001'}" th:text="${reason}"
                                      type="text" rows="10" cols="100" id="disAllowdReason"
                                      name="disAllowdReason"/></textarea>
                        </div>
                    </div>
                    <div class="layui-input-block" th:if="${buttonFlag eq '1001'}">
                        <a  id="send" th:if="${realseFlag eq '1001'}" class="layui-btn" title="发布" href="javascript:;"
                           onclick="videoRealse()">发布</a>
                        <a id="sends" th:if="${audioRealseFlag eq '1001'}" title="发布" href="javascript:;" th:onclick="'audioRealse(' + ${draft.id} + ')'"
                           class="layui-btn"  style="text-decoration:none">发布</a>
                        <a th:if="${agreeFlag eq '1001'}" title="通过" href="javascript:;" th:onclick="pass()"
                           class="layui-btn"  style="text-decoration:none">通过</a>
                        <a  th:if="${rejectFlag eq '1001'}" class="layui-btn" href="javascript:;" id="reject" onclick="reject()">
                            驳回
                        </a>
                        <a  th:if="${updateFlag eq '1001'}" class="layui-btn" href="javascript:;" id="update"  th:onclick="'update(' + ${draft.id} + ')'">
                            修改
                        </a>
                    </div>
                </form>
                <input type="hidden" th:value="${code}" id="code" >
            </div>
</div>
    <!--_footer 作为公共模版分离出去-->
    <div th:replace="_footer :: footerjs"></div>
    <div th:replace="_ueditor :: ueditor"></div>
            <link rel="stylesheet" type="text/css" th:href="@{/xadmin/lib/formSelect/formSelects-v4.css}"/>
            <script type="text/javascript" th:src="@{/xadmin/lib/formselect/formSelects-v4.js}"></script>
            <script th:src="@{/xadmin/lib/jQuery-File-Upload/js/vendor/jquery.ui.widget.js}"></script>
            <script th:src="@{/xadmin/lib/jQuery-File-Upload/js/jquery.iframe-transport.js}"></script>
            <script th:src="@{/xadmin/lib/jQuery-File-Upload/js/jquery.fileupload.js}"></script>


    <!--/_footer 作为公共模版分离出去-->
    <!--请在下方写此页面业务相关的脚本-->
    <script>
        var videoFilename;
        function  videoName(source){
            var arrs = $(source).val().split('\\');
            var filename=arrs[arrs.length-1];
            $(".show").html(filename);
            videoFilename= filename;
        }

        $(function(){
        var status=$('#videoStatusCode').val();
        var videourl=$('#videourlss').val();
        var audiourl=$('#audiourlss').val();
        var draftType=$('#videodraftType').val();
        var  pptStatusCode=$('#pptStatusCode').val();
        var draftType1 = $('#draftType').val();
        if(draftType==2||status==1036){
            var list=document.getElementById("showVideoname");
            if (status==2028||status==2029||status==2038||status==2025||pptStatusCode==1036){
                if (videourl==""){
                    $('#uploadFilename').hide();
                    $('#videouploadname').show();
                }else{
                    $('#uploadFilename').show();
                    $('#videouploadname').hide();
                }

            }else{
                list.removeChild(list.childNodes[1]);
            }

            //录屏显示和隐藏按钮
            if(videourl.trim() != ""){
                $('#videoUrlId').show();
                $('#send').show();
                $('#videofileName').show();
                $('#videosMaker').show();
                $('#LookVideo').show();
             }else{
                $('#videoUrlId').hide();
                $('#send').hide();
                $('#videofileName').hide();
                $('#videosMaker').hide();
                $('#LookVideo').hide();

        }
        }else{
            if(videourl.trim() != ""){
                $('#videoUrlId').show();
                $('#send').show();
                $('#videofileName').show();
                $('#videosMaker').show();
                $('#LookVideo').show();
                if(audiourl.trim() != ""){
                    $('#sends').show();
                }else{
                    $('#sends').hide();
                }
            }else{
                $('#videoUrlId').hide();
                $('#send').hide();
                $('#videosMaker').hide();
                $('#LookVideo').hide();
                $('#sends').hide();
            }
        }
    });

        function update(draftId){
            var draftTitle = $('#draftTitle').val()
            var draftText = UE.getEditor('editor').getContent()
            var draftNum = UE.getEditor('editor').getContentTxt().length;
            var fileName = $('#fileName').val()
            if(draftNum == 0){
                selfmsg("内容不能为空");
                return false
            }
            if(draftTitle.length == 0){
                selfmsg("标题不能为空");
                return false;
            }
            if(fileName.length == 0){
                selfmsg('请输入稿件文件名')
                return false;
            }
            $.ajax({
                type:'post',
                url:"/admin/audio/update",
                cache: false,
                data:{
                    "draftId":draftId,
                    "audioId":$('#audioId').val(),
                    "draftTitle":draftTitle,
                    "draftText":draftText,
                    "draftNum":draftNum,
                    "fileName":fileName,
                },  //重点必须为一个变量如：data
                dataType:'json',
                success:function(data){
                    if (data.code == "1") {
                        selfmsg('修改成功!', 1, function () {
                            window.location.reload();
                            var index = parent.layer.getFrameIndex(window.name);
                            // parent.location.reload();
                            // parent.layer.close(index);
                            $.unlock()
                        });
                    }else {
                        selfmsg('修改失败!');
                        $.unlock()
                    }
                },
                error:function(){
                    selfmsg('修改异常!',5);
                    $.unlock()
                }
            });
        }


        function audioRealse(draftId){
            var draftTitle = $('#draftTitle').val()
            var draftText = UE.getEditor('editor').getContent()
            var draftNum = UE.getEditor('editor').getContentTxt().length;
            var fileName = $('#fileName').val()
            if(draftNum == 0){
                selfmsg("内容不能为空");
                return false
            }
            if(draftTitle.length == 0){
                selfmsg("标题不能为空");
                return false;
            }
            if(fileName.length == 0){
                selfmsg('请输入稿件文件名')
                return false;
            }
            $.ajax({
                type:'post',
                url:'/admin/fileUpload/addAudio',
                cache: false,
                data:{
                    "id":draftId,
                    "draftTitle":draftTitle,
                    "draftText":draftText,
                    "draftNum":draftNum,
                    "fileName":fileName
                },  //重点必须为一个变量如：data
                dataType:'json',
                success:function(data){
                    if (data.code == "1") {
                        selfmsg('发布成功!', 1, function () {
                            window.location.reload();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.location.reload();
                            parent.layer.close(index);
                            $.unlock()
                        });
                    }else {
                        selfmsg('提交失败!');
                        $.unlock()
                    }
                },
                error:function(){
                    selfmsg('提交异常!',5);
                    $.unlock()
                }
            });
        }

        // -----------------拒绝
        function reject(){
            var draftTitle = $('#draftTitle').val();
            var draftText = UE.getEditor('editor').getContent();
            var draftNum = UE.getEditor('editor').getContentTxt().length;
            var fileName = $('#fileName').val();
            var status=$('#videoStatusCode').val();
            var url;
            var code = $('#code').val();
            if(code == '2022'){
                // 对接人拒绝
                url = '/admin/sectionVideo/SectionLeaderFailedReason';
            }else if(code =='2023'){
                url = '/admin/video/refuseAudioVideo';
            }else if(code == '2025'){
                url = '/admin/videoLeader/leaderRefuse';
            }else if(code == '2026'){
                url = '/admin/videoLeader/AuViLeaderFailedReason';
            }else if(code == '2029'){
                url = '/admin/videoLeader/leaderPptRefuse';
            }else if(code == '1038'){
                url = '/admin/sectionVideo/refusePPTVideo';
            }
            var disAllowdReason = $('#disAllowdReason').val().trim();
            if(disAllowdReason.length == 0){
                selfmsg('请输入驳回理由!');
                return;
            }
            if(draftNum == 0){
                selfmsg("内容不能为空");
                return false
            }
            if(draftTitle.length == 0){
                selfmsg("标题不能为空");
                return false;
            }
            if(fileName.length == 0){
                selfmsg('请输入稿件文件名')
                return false;
            }
            $.ajax({
                type:'post',
                url:url,
                cache: false,
                data:{
                    "id":$('#videoId').val(),
                    "reason":disAllowdReason,
                    "draftTitle":draftTitle,
                    "draftText":draftText,
                    "draftNum":draftNum,
                    "fileName":fileName,
                    "status":status,
                },  //重点必须为一个变量如：data
                dataType:'json',
                success:function(data){
                    if (data.code == "1") {
                        selfmsg('驳回成功!', 1, function () {
                            window.location.reload();
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.location.reload();
                            parent.layer.close(index);
                            $.unlock()
                        });
                    }else {
                        selfmsg('提交失败!');
                        $.unlock()
                    }
                },
                error:function(){
                    selfmsg('提交异常!',5);
                    $.unlock()
                }
            });
        }


        // ---------------------通过
         function pass() {
             var draftTitle = $('#draftTitle').val()
             var draftText = UE.getEditor('editor').getContent()
             var draftNum = UE.getEditor('editor').getContentTxt().length;
             var fileName = $('#fileName').val()
             var url;
             var code = $('#code').val();
             if(code =='2023'){
                 url = '/admin/video/passAudioVideo?id='+$('#videoId').val();
             }else if(code == '1038'){
                 url = '/admin/video/passPptorVideo?id='+$('#videoId').val();
             }else if(code == '2025'){
                 url = '/admin/video/passBossPptVideo?id='+$('#videoId').val();
             }else if(code == '2022'){
                 url = '/admin/sectionVideo/successById?id='+$('#videoId').val();
             }
             layer.open({
            title: '审核提示',
            content: '确认审核通过吗?',
            btn: ['确认', '取消'],
            yes: function(index, layero){//两个参数:当前层索引,当前层DOM对象
                //按钮【确认】的回调
                if(draftNum == 0){
                    selfmsg("内容不能为空");
                    return false
                }
                if(draftTitle.length == 0){
                    selfmsg("标题不能为空");
                    return false;
                }
                if(fileName.length == 0){
                    selfmsg('请输入稿件文件名')
                    return false;
                }
                $.lock();
                $.ajax({
                    type:'GET',
                    url:url,
                    data:{
                        "draftTitle":draftTitle,
                        "draftText":draftText,
                        "draftNum":draftNum,
                        "fileName":fileName,
                    },
                    cache: false,
                    dataType:'json',
                    success:function(data){
                        if (data.code == "1") {
                            selfmsg('审核通过!', 1, function () {
                                window.location.reload();
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.location.reload();
                                parent.layer.close(index);
                                $.unlock()
                            });
                        }else {
                            selfmsg('提交失败!');
                            $.unlock()
                        }
                    },

                    error:function(XMLHttpRequest, textStatus, errorThrown){
                        selfmsg('提交异常!',5);
                        $.unlock()
                    }
                });
            },
            btn2: function(index, layero){
                //按钮【取消】的回调
                //return false 开启该代码可禁止点击该按钮关闭
            },
        });
    };

        // --------------发布
        layui.use(['form', 'layer','laydate'],function() {
        $ = layui.jquery;
        var form = layui.form,
            laydate = layui.laydate,
            layer = layui.layer;
        lay('.timeSpace').each(function(){
            laydate.render({
                elem: this,
                trigger: 'click',
                type: 'datetime'
            });
        });
    });


      //发布录屏
        function videoRealse(){
            var status=$('#videoStatusCode').val();
            var  pptStatusCode=$('#pptStatusCode').val();
            var draftTitle = $('#draftTitle').val();
            var draftText = UE.getEditor('editor').getContent();
            var draftNum = UE.getEditor('editor').getContentTxt().length;
            var fileName = $('#fileName').val();
            var id=$('#draftId').val();
            var draft=$('#draft').val();
            var videoGroupId=$('#videoGroupId').val();
             if(draftNum == 0){
                    selfmsg("内容不能为空");
                    return false
                }
                if(draftTitle.length == 0){
                    selfmsg("标题不能为空");
                    return false;
                }
                if(fileName.length == 0){
                    selfmsg('请输入稿件文件名')
                    return false;
                }
            $.ajax({
                    url: "/admin/fileUpload/addVideo",
                    data:{
                        "draft":draft,
                        "id":id,
                        "status":status,
                        "pptStatusCode":pptStatusCode,
                        "draftTitle":draftTitle,
                        "draftText":draftText,
                       "draftNum": draftNum,
                       "fileName": fileName,
                        "videoFilename":videoFilename,
                        "videoGroupId":videoGroupId,
                    },
                    type: 'POST',
                    dataType:'json',
                    success: function (data) {
                        if (data.code == "1") {
                            selfmsg('发布成功!', 1, function () {
                                var index = parent.layer.getFrameIndex(window.name);
                                parent.location.reload();
                                parent.layer.close(index);
                                $.unlock();
                            });
                        } else {
                            $.unlock();
                            selfmsg('发布失败!');
                        }
                    },
                    error: function () {
                        $.unlock();
                        selfmsg('发布异常!', 5);
                    }
                });
    };

        //删除图片
        function closeImg(obj) {
            $(obj).parent().remove();
            // var goods_img = '';
            // $('.imgcon .img_div').each(function () {
            //     goods_img += $(this).find('img').attr('src') + ',';
            // })
            $('.meetingIcon').val('');
            if ($('.imgcon').children().length == 1) {
                $('.addimg').css('display', 'none');
            }
            if ($('.imgcon').children().length < 1) {
                $('.addimg').css('display', 'inline-block');
            }
        }


                $(function () {
            $('.filesave').fileupload({
                dataType: 'json',
                change: function (e, data) {
                    var len = $('.imgcon').children().length;
                    if (data.files.length > (1 - parseInt(len))) {
                        layer.msg('最多上传1张图片');
                        return false;
                    }
                },
                start: function (e) {
                    layer_msg = layer.msg('正在上传中…', {time: 100000000});
                },
                progressall: function (e, data) {
                    $('.layui-layer-msg .layui-layer-content').html('已上传' + (data.loaded / data.total * 100).toFixed(2) + '%');
                },
                done: function (e, data) {
                    // window.location.reload();
                    // var index = parent.layer.getFrameIndex(window.name);
                    // parent.location.reload();
                    // parent.layer.close(index);
                    $('#audioUrl').attr("src",data.result.msg);
                    layer.close(layer_msg);
                    if($('#videourlss').val().trim() != "" || $('#videoUrlId').attr("src") != ""){
                        $('#sends').show();
                    }
                },
                done: function (e, data) {
                    $('#audioUrl').attr("src",data.result.msg);
                    layer.close(layer_msg);
                    if($('#videourlss').val().trim() != "" || $('#videoUrlId').attr("src") != ""){
                        $('#sends').show();
                    }
                }
            });

        });


        //上传视频
        $(function () {
            var draftType=$('#videodraftType').val();
              var videourlss=$('#videourlss').val();
            var draftType1=$('#draftType').val();
            $('#fileupload').fileupload({
                dataType: 'json',
                dropZone: $('#drag'),
                change: function (e, data) {
                    var len = $('.imgcon').children().length;
                    if (data.files.length > (1 - parseInt(len))) {
                        layer.msg('最多上传1张图片');
                        return false;
                    }
                },
                start: function (e) {
                    layer_msg = layer.msg('正在上传中…', {time: 100000000});
                },
                progressall: function (e, data) {
                    $('.layui-layer-msg .layui-layer-content').html('已上传' + (data.loaded / data.total * 100).toFixed(2) + '%');
                },
                done: function (e, data) {
                    $('#videoUrlId').attr("src",data.result.msg);
                    console.dir(videourlss)
                    console.dir(draftType)
                    console.dir(draftType1)
                    if (draftType1 == 4){
                        $('#videoUrlId').show();
                        $('#send').show();
                        $('#videosMaker').show();
                        $('#LookVideo').show();
                        $('#videoFilename').show();
                        $('#uploadFilename').hide();
                        $('#videouploadname').show();
                        layer.close(layer_msg);
                    }else{
                        $('#videofileName').show();
                        $('#videoUrlId').show();
                        $('#send').show();
                        $('#videosMaker').show();
                        $('#LookVideo').show();
                        if($('#audiourlss').val().trim() != "" || $('#audioUrl').attr("src") != ""){
                            $('#sends').show();
                         }
                        layer.close(layer_msg);
                    }
                    // window.location.reload();
                    layer.close(layer_msg);
                }

            });
            $('#drag').bind('drop dragover', function (e) {
                e.preventDefault();
            }).on('dragenter', function (e) {
                $(this).addClass('dragenter');
            }).on('drop', function (e) {
                $(this).removeClass('dragenter');
            }).on('dragleave', function (e) {
                $(this).removeClass('dragenter');
            });

            /**
             * 数据回调
             * @param id
             * @param value
             */
            function callback(value) {
                var $li = $(
                    "<div class=\"img_div\">" +
                    "<a onclick=\"$(this).attr('href', $(this).find('img').attr('src'))\" type=\"button\"  data-lightbox=\"preview\">" +
                    "<video src=\"" + value + "\" alt=\"\" style='height: 200px;" +
                    "width:300px;' controls=\"controls\"  preload='preload'>" + "</video>" +
                    "</a>" +
                    "<i class='layui-icon layui-icon-delete close' onclick='closeImg(this)'></i>" +
                    "</div>"
                );
                $('.imgcon').append($li);
                if ($('.imgcon').children().length == 1) {
                    $('.addimg').css('display', 'none');
                }
                // var goods_img = '';
                // $('.imgcon .img_div').each(function () {
                //     goods_img += $(this).find('img').attr('src') + ',';
                // })
                $('.goods_img').val($(this).find('img').attr('src'));
                $("#videoUrl").val(value);
            }

            //图片回显
            if ("$document.getElementsByName('name')" != '') {
                var goods_img = $(document.getElementsByName('name'));
                $('.goods_img').val(goods_img);
                // var arr = goods_img.split(',');
                // for (var i = 0; i < arr.length; i++) {
                //     if (arr[i] != '') {
                //         callback(arr[i]);
                //     }
                // }
                if ($('.imgcon').children().length == 1) {
                    $('.addimg').css('display', 'none');
                }

            }
        });
    </script>
</body>
</html>